\(\int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx\) [239]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 77 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {a^2 x}{2}-b^2 x+\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {b^2 \tan (c+d x)}{d} \]

[Out]

1/2*a^2*x-b^2*x+2*a*b*arctanh(sin(d*x+c))/d-2*a*b*sin(d*x+c)/d-1/2*a^2*cos(d*x+c)*sin(d*x+c)/d+b^2*tan(d*x+c)/
d

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.421, Rules used = {4482, 2801, 2715, 8, 2672, 327, 212, 3554} \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=-\frac {a^2 \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a^2 x}{2}+\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \sin (c+d x)}{d}+\frac {b^2 \tan (c+d x)}{d}-b^2 x \]

[In]

Int[(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

(a^2*x)/2 - b^2*x + (2*a*b*ArcTanh[Sin[c + d*x]])/d - (2*a*b*Sin[c + d*x])/d - (a^2*Cos[c + d*x]*Sin[c + d*x])
/(2*d) + (b^2*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 2801

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Int[Expan
dIntegrand[(g*Tan[e + f*x])^p, (a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2
, 0] && IGtQ[m, 0]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int (b+a \cos (c+d x))^2 \tan ^2(c+d x) \, dx \\ & = \int \left (a^2 \sin ^2(c+d x)+2 a b \sin (c+d x) \tan (c+d x)+b^2 \tan ^2(c+d x)\right ) \, dx \\ & = a^2 \int \sin ^2(c+d x) \, dx+(2 a b) \int \sin (c+d x) \tan (c+d x) \, dx+b^2 \int \tan ^2(c+d x) \, dx \\ & = -\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {b^2 \tan (c+d x)}{d}+\frac {1}{2} a^2 \int 1 \, dx-b^2 \int 1 \, dx+\frac {(2 a b) \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d} \\ & = \frac {a^2 x}{2}-b^2 x-\frac {2 a b \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {b^2 \tan (c+d x)}{d}+\frac {(2 a b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (c+d x)\right )}{d} \\ & = \frac {a^2 x}{2}-b^2 x+\frac {2 a b \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \sin (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {b^2 \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.80 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.51 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=-\frac {-2 \left (a^2-2 b^2\right ) (c+d x)+8 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-8 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+8 a b \sin (c+d x)+\left (a^2-4 b^2+a^2 \cos (2 (c+d x))\right ) \tan (c+d x)}{4 d} \]

[In]

Integrate[(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

-1/4*(-2*(a^2 - 2*b^2)*(c + d*x) + 8*a*b*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - 8*a*b*Log[Cos[(c + d*x)/2]
 + Sin[(c + d*x)/2]] + 8*a*b*Sin[c + d*x] + (a^2 - 4*b^2 + a^2*Cos[2*(c + d*x)])*Tan[c + d*x])/d

Maple [A] (verified)

Time = 1.23 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.00

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (\tan \left (d x +c \right )-d x -c \right )}{d}\) \(77\)
default \(\frac {a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+2 a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \left (\tan \left (d x +c \right )-d x -c \right )}{d}\) \(77\)
parts \(\frac {a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {b^{2} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {2 a b \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(84\)
risch \(\frac {a^{2} x}{2}-x \,b^{2}+\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {i a b \,{\mathrm e}^{i \left (d x +c \right )}}{d}-\frac {i a b \,{\mathrm e}^{-i \left (d x +c \right )}}{d}-\frac {i a^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i b^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a b \ln \left (i+{\mathrm e}^{i \left (d x +c \right )}\right )}{d}\) \(146\)

[In]

int((sin(d*x+c)*a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(-1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)+2*a*b*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))+b^2*(tan(d*x
+c)-d*x-c))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.40 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {{\left (a^{2} - 2 \, b^{2}\right )} d x \cos \left (d x + c\right ) + 2 \, a b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - 2 \, a b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) - {\left (a^{2} \cos \left (d x + c\right )^{2} + 4 \, a b \cos \left (d x + c\right ) - 2 \, b^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

[In]

integrate((a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*((a^2 - 2*b^2)*d*x*cos(d*x + c) + 2*a*b*cos(d*x + c)*log(sin(d*x + c) + 1) - 2*a*b*cos(d*x + c)*log(-sin(d
*x + c) + 1) - (a^2*cos(d*x + c)^2 + 4*a*b*cos(d*x + c) - 2*b^2)*sin(d*x + c))/(d*cos(d*x + c))

Sympy [F]

\[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2}\, dx \]

[In]

integrate((a*sin(d*x+c)+b*tan(d*x+c))**2,x)

[Out]

Integral((a*sin(c + d*x) + b*tan(c + d*x))**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.09 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2}}{4 \, d} - \frac {{\left (d x + c - \tan \left (d x + c\right )\right )} b^{2}}{d} + \frac {a b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )}}{d} \]

[In]

integrate((a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/4*(2*d*x + 2*c - sin(2*d*x + 2*c))*a^2/d - (d*x + c - tan(d*x + c))*b^2/d + a*b*(log(sin(d*x + c) + 1) - log
(sin(d*x + c) - 1) - 2*sin(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2320 vs. \(2 (73) = 146\).

Time = 0.75 (sec) , antiderivative size = 2320, normalized size of antiderivative = 30.13 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\text {Too large to display} \]

[In]

integrate((a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/2*a^2*x - 1/4*a^2*sin(2*d*x + 2*c)/d - (b^2*d*x*tan(d*x)*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) + a*b*log(2*(tan
(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/
2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))
*tan(d*x)*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1
/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(
1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) - b^
2*d*x*tan(1/2*d*x)^2*tan(1/2*c)^2 + b^2*d*x*tan(d*x)*tan(1/2*d*x)^2*tan(c) + b^2*d*x*tan(d*x)*tan(1/2*c)^2*tan
(c) - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan
(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2
+ tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*t
an(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(
tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 + b^2*tan(d*x)*t
an(1/2*d*x)^2*tan(1/2*c)^2 + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*
d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2
*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(1/2*d*x)^2*tan(c) - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2
*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*
d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(1/2*d
*x)^2*tan(c) - 4*a*b*tan(d*x)*tan(1/2*d*x)^2*tan(1/2*c)*tan(c) + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*ta
n(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan
(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(1/2*c)^2*tan(c) -
 a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*
d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan
(1/2*c)^2 + 1))*tan(d*x)*tan(1/2*c)^2*tan(c) - 4*a*b*tan(d*x)*tan(1/2*d*x)*tan(1/2*c)^2*tan(c) + b^2*tan(1/2*d
*x)^2*tan(1/2*c)^2*tan(c) - b^2*d*x*tan(1/2*d*x)^2 - b^2*d*x*tan(1/2*c)^2 + b^2*d*x*tan(d*x)*tan(c) - a*b*log(
2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 +
tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2
 + 1))*tan(1/2*d*x)^2 + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*
tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2
 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2 + b^2*tan(d*x)*tan(1/2*d*x)^2 + 4*a*b*tan(1/2*d*x)^2*tan
(1/2*c) - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 +
 tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x
)^2 + tan(1/2*c)^2 + 1))*tan(1/2*c)^2 + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) -
 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x
)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*c)^2 + b^2*tan(d*x)*tan(1/2*c)^2 + 4*a*b*tan(1/
2*d*x)*tan(1/2*c)^2 + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*ta
n(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 +
 tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(c) - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)
^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) +
1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(d*x)*tan(c) + 4*a*b*tan(d*x)*tan(1/2
*d*x)*tan(c) + b^2*tan(1/2*d*x)^2*tan(c) + 4*a*b*tan(d*x)*tan(1/2*c)*tan(c) + b^2*tan(1/2*c)^2*tan(c) - b^2*d*
x - a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1
/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 +
tan(1/2*c)^2 + 1)) + a*b*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan
(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 +
tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1)) + b^2*tan(d*x) - 4*a*b*tan(1/2*d*x) - 4*a*b*tan(1/2*c) + b^2*tan(c))/(d*ta
n(d*x)*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c) - d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(d*x)*tan(1/2*d*x)^2*tan(c) +
 d*tan(d*x)*tan(1/2*c)^2*tan(c) - d*tan(1/2*d*x)^2 - d*tan(1/2*c)^2 + d*tan(d*x)*tan(c) - d)

Mupad [B] (verification not implemented)

Time = 22.87 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.86 \[ \int (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {b^2\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}-\frac {2\,a\,b\,\sin \left (c+d\,x\right )}{d}+\frac {4\,a\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a^2\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{2\,d} \]

[In]

int((a*sin(c + d*x) + b*tan(c + d*x))^2,x)

[Out]

(a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (2*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d +
(b^2*sin(c + d*x))/(d*cos(c + d*x)) - (2*a*b*sin(c + d*x))/d + (4*a*b*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)
/2)))/d - (a^2*cos(c + d*x)*sin(c + d*x))/(2*d)